#{extends 'main.html' /}
#{set title:'Browse repo' /}

#{if file.isRoot() && file.listFiles().length == 0}
    <div class="alert alert-info">
        No file yet.
    </div>
#{/if}
#{else}
    #{if moduleVersion}
        <div class="alert alert-info">
            <a href="@{Repo.view(moduleVersion.module.name, moduleVersion.version)}"><i class="icon-info-sign"></i> View module version page</a>.
        </div>
    #{/if}
    #{if module}
        <div class="alert alert-info">
            <a href="@{Repo.versions(module.name)}"><i class="icon-info-sign"></i> View module page</a>.
        </div>
    #{/if}
    <table class="table">
        <caption>Browse ${file.relative() ?: 'root'}</caption>
        #{if !file.isRoot()}
        <tr>
            <td colspan="3"><a href="${util.Util.viewRepoUrl(file.parentFile.relative())}" title="Browse parent folder"><i class="icon-folder-open"></i> Parent</a></td>
        </tr>
        #{/if}
        #{list items:file.listFilesSorted(), as:'child'}
        <tr>
            <td><a href="${util.Util.viewRepoUrl(child.relative())}" title="${child.directory ? 'Browse folder' : 'View file'}"><i class="icon-${child.directory ? 'folder-open' : 'file'}"></i> ${child.name}</a></td>
            <td>
                #{if child.directory}${child.folderSize().formatSize()}#{/if}
                #{else}${child.length().formatSize()}#{/else}
            </td>
        </tr>
        #{/list}
    </table>
#{/else}
